package com.fc.test.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fc.test.common.base.BaseService;
import com.fc.test.common.support.Convert;
import com.fc.test.mapper.auto.AbbPingtaiMapper;
import com.fc.test.model.auto.AbbPingtai;
import com.fc.test.model.auto.AbbPingtaiExample;
import com.fc.test.model.custom.Tablepar;
import com.fc.test.util.SnowflakeIdWorker;

/**
 * Service
* @Title: AbbPingtaiService.java 
* @Package com.fc.test.entity 
* @author fuce
* @email 87766867@qq.com
* @date 2019-08-15 09:02:09  
 */
@Service
public class AbbPingtaiService implements BaseService<AbbPingtai, AbbPingtaiExample>{
	@Autowired
	private AbbPingtaiMapper abbPingtaiMapper;

	/**
	 * 分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	 public PageInfo<AbbPingtai> list(Tablepar tablepar,String name){
	        AbbPingtaiExample testExample=new AbbPingtaiExample();
	        testExample.setOrderByClause("id ASC");
	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
	        List<AbbPingtai> list= abbPingtaiMapper.selectByExample(testExample);
	        PageInfo<AbbPingtai> pageInfo = new PageInfo<AbbPingtai>(list);
	        return  pageInfo;
	 }

	@Override
	public int deleteByPrimaryKey(String ids) {
		List<String> lista=Convert.toListStrArray(ids);
		AbbPingtaiExample example=new AbbPingtaiExample();
		example.createCriteria().andIdIn(lista);
		return abbPingtaiMapper.deleteByExample(example);
	}


	@Override
	public AbbPingtai selectByPrimaryKey(String id) {

		return abbPingtaiMapper.selectByPrimaryKey(id);
	}


	@Override
	public int updateByPrimaryKeySelective(AbbPingtai record) {
		return abbPingtaiMapper.updateByPrimaryKeySelective(record);
	}

	/**
	 * 添加
	 */
	@Override
	public int insertSelective(AbbPingtai record) {
		//添加雪花主键id
		record.setId(SnowflakeIdWorker.getUUID());
		return abbPingtaiMapper.insertSelective(record);
	}










	@Override
	public int updateByExampleSelective(AbbPingtai record, AbbPingtaiExample example) {

		return abbPingtaiMapper.updateByExampleSelective(record, example);
	}


	@Override
	public int updateByExample(AbbPingtai record, AbbPingtaiExample example) {

		return abbPingtaiMapper.updateByExample(record, example);
	}

	@Override
	public List<AbbPingtai> selectByExample(AbbPingtaiExample example) {

		return abbPingtaiMapper.selectByExample(example);
	}


	@Override
	public long countByExample(AbbPingtaiExample example) {

		return abbPingtaiMapper.countByExample(example);
	}


	@Override
	public int deleteByExample(AbbPingtaiExample example) {

		return abbPingtaiMapper.deleteByExample(example);
	}




}
